home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9172 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  48 lines

  1. Path: library.erc.clarkson.edu!rpi!not-for-mail
  2. From: davidb@datalytics.com (David Bradley)
  3. Newsgroups: comp.lang.c++,comp.lang.c++.moderated
  4. Subject: Re: Argc & Argv
  5. Date: 28 Feb 1996 15:00:25 -0000
  6. Organization: Datalytics Inc.
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: Dietmar.Kuehl@uni-konstanz.de
  9. Message-ID: <4h1qm9$8h2@netlab.cs.rpi.edu>
  10. References: <4gta9f$df5@netlab.cs.rpi.edu>
  11. NNTP-Posting-Host: netlab.cs.rpi.edu
  12. X-Original-Date: Tue, 27 Feb 1996 19:09:31 GMT
  13.  
  14. Rick Richert <richert@butch.lmsc.lockheed.com> wrote:
  15.  
  16. >SomeClass obj( argc, argv);
  17. >int main( int argc, char **argv) {
  18. >   blah, blah, blah
  19. >}
  20.  
  21. The following is the only way I know of to accomplish what you want.
  22.  
  23. SomeClass* pObject = 0;
  24.  
  25. int main(int argc,char *argv[])
  26. {
  27.     pObject = new SomeClass(argc,argv);
  28. }
  29.  
  30. On some OS's you can call a function to get the arguments of the
  31. program.  If that's available that would be an alternative.  You'd
  32. then just provide a default constructor and have the constructor call
  33. the appropiate functions.  NT for example uses GetCommandLine to
  34. retrieve the command line string.
  35.  
  36. ===============================================
  37. DISCLAIMER: I may be a member of humanity,
  38. but I'm not a spokesman for humanity.
  39.     davidb@datalytics.com
  40.  
  41.       [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
  42.       [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
  43.       [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
  44.       [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
  45.